package org.apmap.base;

import org.apmap.common.Currency;

import javax.persistence.*;

@Entity
@Table(name = "office")
public class Office {

    private long id;
    private User user;
    private double lng;
    private long lngLong;
    private double lat;
    private long latLong;

//    private Map<String, String> properties;

    private OfferType type = OfferType.RENT;
    private String address = "";
    private byte roomNumber = 0;
    private int square = 0;
    private byte floor = 0;
    private double price = 0;
    private Currency currency = Currency.USD;
    private String comment = "";

    private long userid = 0;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false, length = 10)
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @ManyToOne
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @Basic
    @Column(name = "lng", nullable = false)
    public double getLng() {
        return lng;
    }

    public void setLng(double lng) {
        this.lng = lng;
    }

    @Basic
    @Column(name = "lnglong", nullable = false)
    public long getLngLong() {
        return lngLong;
    }

    public void setLngLong(long lngLong) {
        this.lngLong = lngLong;
    }

    @Basic
    @Column(name = "lat", nullable = false)
    public double getLat() {
        return lat;
    }

    public void setLat(double lat) {
        this.lat = lat;
    }

    @Basic
    @Column(name = "latlong", nullable = false)
    public long getLatLong() {
        return latLong;
    }

    public void setLatLong(long latLong) {
        this.latLong = latLong;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String toString() {
        return "Office: " + id + " lat=" + lat  + " lng=" + lng;
    }

    @Basic
    @Column(name = "roomnumber", nullable = false)
    public byte getRoomNumber() {
        return roomNumber;
    }

    public void setRoomNumber(byte roomNumber) {
        this.roomNumber = roomNumber;
    }

    @Basic
    @Column(name = "square", nullable = false)
    public int getSquare() {
        return square;
    }

    public void setSquare(int square) {
        this.square = square;
    }

    @Basic
    @Column(name = "floor", nullable = false)
    public byte getFloor() {
        return floor;
    }

    public void setFloor(byte floor) {
        this.floor = floor;
    }

    @Basic
    @Column(name = "price", nullable = false)
    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    @Basic
    @Column(name = "currency", nullable = false)
    public Currency getCurrency() {
        return currency;
    }

    public void setCurrency(Currency currency) {
        this.currency = currency;
    }

    @Basic
    @Column(name = "comment", nullable = false)
    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    @Basic
    @Column(name = "type", nullable = false)
    public OfferType getType() {
        return type;
    }

    public void setType(OfferType type) {
        this.type = type;
    }

    @Transient
    public long getUserid() {
        return userid;
    }

    public void setUserid(long userid) {
        this.userid = userid;
    }
}